private String  getWxAccessToken(HttpServletRequest request) throws Exception
	{
		ServletContext application =request.getSession().getServletContext(); 
		Object strAccessToken = application.getAttribute("wxAccessToken");
		Object dtTime = application.getAttribute("wxAccessTime");
		if (strAccessToken != null && dtTime!=null) {
			long timeNow = (new Date()).getTime();
			long timeLastUpdate = ((Date)dtTime).getTime();
			long lSapce = (timeNow - timeLastUpdate)/1000;
			if (strAccessToken.toString().length()>0 && lSapce >0 && lSapce <7000) {
				logger.info("The session access_token : "+strAccessToken.toString());
				return strAccessToken.toString();
			}
		}
	
		String host = "https://api.weixin.qq.com";
		String path = "/cgi-bin/token";
		String method = "GET";
		Map<String, String> headers = new HashMap<String, String>();
		String strQuerys = "grant_type=client_credential&appid=" + ghconfig.getAppID() + "&secret="
				+ ghconfig.getAppSecret() + "";
		HttpResponse response = HttpUtils.doGet(host, path, method, headers, strQuerys);
		String strResult = EntityUtils.toString(response.getEntity(),"UTF-8");
		logger.info(strResult);
		String accessToken = JSONObject.parseObject(strResult).getString("access_token");
		logger.info("get access token from wx server ,data : "+accessToken);
		//去微信请求accesstoken
		application.setAttribute("wxAccessToken", accessToken);
		application.setAttribute("wxAccessTime", new Date());
		return accessToken;
	}



//调用方式：getWxAccessToken(request) 
